package org.gd.hellojaxb.privat24.ekb.tests;

import org.gd.hellojaxb.privat24.ekb.models.EKBResponse;
import org.gd.hellojaxb.utils.MarshallProperties;
import org.gd.hellojaxb.utils.Marshall;
import org.gd.hellojaxb.utils.UnMarshall;

import javax.xml.bind.JAXBException;
import java.io.IOException;

public class TestEKBResponse {

    public static void main(String...args) throws JAXBException, IOException {
        String str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> " +
                "<doc> " +
                "  <r  key=\"1\"> " +
                "    <LST Id=\"51701439\" DB=\"1989-10-26\" OKPO=\"3280615918\" Sex=\"M\" CountryRes=\"UA\" uaLName=\"Горховер\" uaFName=\"Дмитрий\" uaMName=\"Петрович\" ruLName=\"Горховер\" ruFName=\"Дмитрий\" ruMName=\"Петрович\" enLName=\"null\" enFName=\"null\" enMName=\"null\" PhoneH=\"null\" PhoneW=\"+380665931637\" PhoneM=\"+380937103721\" ZipJur=\"49000\" StateJur=\"ДНЕПРОПЕТРОВСКАЯ\" CityJur=\"null\" StreetJur=\"ФРУНЗЕ 6А, 30\" CountryFact=\"UA\" ZipFact=\"49000\" StateFact=\"ДНЕПРОПЕТРОВСКАЯ\" CityFact=\"null\" StreetFact=\"ФРУНЗЕ6А 6А, 30\" TownJur=\"ДНЕПРОПЕТРОВСК\" SubTownJur=\"null\" TownFact=\"ДНЕПРОПЕТРОВСК\"> " +
                "      <DOC DId=\"1012548169\" DDS=\"2005-12-26\" DNum=\"470040\" DSer=\"АН\" DType=\"000001\" DSt=\"A\" DCountry=\"UA\" DWho=\"ДНЕПРОПЕТРОВСКИМ РО УМВД\"/> " +
                "      <DOC DId=\"1012548169\" DDS=\"2005-12-26\" DNum=\"470040\" DSer=\"АН\" DType=\"000001\" DSt=\"A\" DCountry=\"UA\" DWho=\"ДНЕПРОПЕТРОВСКИМ РО УМВД\"/> " +
                "    </LST> " +
                "  </r> " +
                "</doc> ";
        EKBResponse ekbResponse = UnMarshall.unmarshal(str, EKBResponse.class);
        System.out.println(Marshall.getInstance().marshal(
                ekbResponse,
                MarshallProperties.FORMATTED_OUTPUT));
    }
}
